#include "functions.h"

void offspring(){
  int i, j, k;
  int num;
  double new_point;

  for( i = 0; i < number_of_layers; i++ )
    {
      for( j = 0; j < each_individuals; j++ )
	{
	  for( k = 0; k < number_of_dimensions; k++ )
	    {
	      num = 0;
	      do {
		num++;

		new_point = gaussrand( layers[ i ].center[ k ], layers[ i ].sigma[ k ] );
		
		if( num > 20 ){
		  if( ( upper_limit + lower_limit ) / 2 > new_point ){
		    new_point = lower_limit;
		  } else{
		    new_point = upper_limit;
		  }
		}

	      }while( new_point < lower_limit || new_point > upper_limit );

	      layers[ i ].individuals[ j ].design_variables[ k ] = new_point;

	    } // end of number_of_dimensions

	  layers[ i ].individuals[ j ].function_value = evaluate( layers[ i ].individuals[ j ].design_variables );
	}
    }
}
